package mspbots.autotask.client.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import mspbots.autotask.common.RabbitKeys;
import org.springframework.amqp.core.*;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

/**
 * com.mspbots.sync.config.RabbitConfigurer
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2019/7/29
 */
@Configuration
public class RabbitConfiguration {

    private final AmqpAdmin amqpAdmin;
    private final Exchange exchange;

    Map<String, Object> args = new HashMap<>(4) {{
        put("x-dead-letter-exchange", RabbitKeys.BASE_EXCHANGE_NAME);
        put("x-dead-letter-routing-key", RabbitKeys.BAD_MESSAGE_QUEUE_KEY);
    }};

    public RabbitConfiguration(AmqpAdmin amqpAdmin) {
        this.amqpAdmin = amqpAdmin;
        this.exchange = ExchangeBuilder.directExchange(RabbitKeys.BASE_EXCHANGE_NAME).build();
        this.amqpAdmin.declareExchange(exchange);
    }

    @Bean
    public void declareBaseExchange() {
        Queue queue = QueueBuilder.durable("auto-task.bad.message")
                .withArgument("x-message-ttl", 1000 * 60 * 60 * 24).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.BAD_MESSAGE_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.distributed.task.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.DISTRIBUTED_TASK_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.logs.task.sync").withArguments(args).build();

        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.LOGS_TASK_QUEUE_KEY).noargs());
    }

    @Bean
    public void initializationQueue1() {
        Queue queue = QueueBuilder.durable("auto-task.users.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.USERS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.tickets.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.TICKETS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.companies.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.COMPANIES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.contacts.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTACTS_SYNC_QUEUE_KEY).noargs());

        //projects
        queue = QueueBuilder.durable("auto-task.projects.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.PROJECTS_SYNC_QUEUE_KEY).noargs());

        //tasks
        queue = QueueBuilder.durable("auto-task.tasks.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.TASKS_SYNC_QUEUE_KEY).noargs());

        //departments
        queue = QueueBuilder.durable("auto-task.departments.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.DEPARTMENTS_SYNC_QUEUE_KEY).noargs());

        //contracts
        queue = QueueBuilder.durable("auto-task.contracts.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACTS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.time-entries.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.TIME_ENTRIES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.entity-information.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.INFORMATION_SYNC_QUEUE_KEY).noargs());
    }

    @Bean
    public void initializationQueue2() {

        Queue queue = QueueBuilder.durable("auto-task.contract-blocks.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACT_BLOCKS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.phases.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.PHASES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.opportunities.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.OPPORTUNITIES_SYNC_QUEUE_KEY).noargs());


        queue = QueueBuilder.durable("auto-task.invoices.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.INVOICES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.contract-service-units.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACT_SERVICE_UNITS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.survey-results.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SURVEY_RESULTS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.contract-service-bundle-units.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACT_SERVICE_BUNDLE_UNITS_SYNC_QUEUE_KEY).noargs());

        //project-attachments
        queue = QueueBuilder.durable("auto-task.project-attachments.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.PROJECT_ATTACHMENTS_SYNC_QUEUE_KEY).noargs());
        queue = QueueBuilder.durable("auto-task.service-call-ticket-resources.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_CALL_TICKET_RESOURCES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-calls.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_CALLS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.products.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.PRODUCTS_SYNC_QUEUE_KEY).noargs());

    }

    @Bean
    public void initializationQueue3() {

        Queue queue = QueueBuilder.durable("auto-task.configuration-items.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONFIGURATION_ITEMS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.roles.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.ROLES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.resource-role-queues.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.RESOURCE_ROLE_QUEUES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.client-portal-users.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CLIENT_PORTAL_USERS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.additional-invoice-field-values.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ADDITIONAL_INVOICE_FIELD_VALUES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-call-task-resource.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_CALL_TASK_RESOURCE_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-level-agreement-results.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_LEVEL_AGREEMENT_RESULTS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-call-tasks.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_CALL_TASKS_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-bundles.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_BUNDLES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.action-types.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ACTION_TYPES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.change-request-links.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CHANGE_REQUEST_LINKS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.checklist-libraries.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CHECKLIST_LIBRARIES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.checklist-library-checklist-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CHECKLIST_LIBRARY_CHECKLIST_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.class-ification-icons.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CLASS_IFICATION_ICONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.comanaged-associations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMANAGED_ASSOCIATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.configuration-item-billing-product-associations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONFIGURATION_ITEM_BILLING_PRODUCT_ASSOCIATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.configuration-item-categories.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONFIGURATION_ITEM_CATEGORIES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.configuration-item-category-udf-associations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONFIGURATION_ITEM_CATEGORY_UDF_ASSOCIATIONS_SYNC_QUEUE_KEY).noargs());

    }

//    @Bean
//    public void initializationQueue4() {

//        Queue queue = QueueBuilder.durable("auto-task.configuration-item-notes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONFIGURATION_ITEM_NOTES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.configuration-item-types.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONFIGURATION_ITEM_TYPES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-notes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_NOTES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-rates.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_RATES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-retainers.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_RETAINERS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-role-costs.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_ROLE_COSTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.invoice-templates.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVOICE_TEMPLATES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.notification-history.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.NOTIFICATION_HISTORY_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.opportunity-attachments.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.OPPORTUNITY_ATTACHMENTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.organizational-level1.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ORGANIZATIONAL_LEVEL1_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.organizational-level2.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ORGANIZATIONAL_LEVEL2_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.price-list-products.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PRICE_LIST_PRODUCTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.price-list-product-tiers.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PRICE_LIST_PRODUCT_TIERS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.billing-item-approval-levels.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.BILLING_ITEM_APPRAVAL_LEVELS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.billing-codes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.BILLING_CODES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-alerts.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_ALERTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-attachments.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_ATTACHMENTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-locations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_LOCATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-billing-rules.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_BILLING_RULES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-block-hour-factors.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_BLOCK_HOUR_FACTORS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-charges.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_CHARGES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-exclusion-roles.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_EXCLUSION_ROLES_SYNC_QUEUE_KEY).noargs());

//    }

//    @Bean
//    public void initializationQueue5() {

//        Queue queue = QueueBuilder.durable("auto-task.contract-exclusion-set-excluded-roles.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_EXCLUSION_SET_EXCLUDED_ROLES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-exclusion-set-excluded-work-types.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_EXCLUSION_SET_EXCLUDED_WORK_TYPES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-exclusion-sets.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_EXCLUSION_SETS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.expense-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.EXPENSE_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.expense-reports.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.EXPENSE_REPORTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.holidays.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.HOLIDAYS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.holiday-sets.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.HOLIDAY_SETS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.internal-locations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INTERNAL_LOCATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.organizational-level-associations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ORGANIZATIONAL_LEVEL_ASSOCIATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.quote-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.QUOTE_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.organizational-resources.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.ORGANIZATIONAL_RESOURCES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.purchase-approvals.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PURCHASE_APPROVALS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.purchase-order-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PURCHASE_ORDER_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.appointments.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.APPOINTMENTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.billing-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.BILLING_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.change-order-charges.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CHANGE_ORDER_CHARGES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-notes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_NOTES_SYNC_QUEUE_KEY).noargs());

//    }

    @Bean
    public void initializationQueue6() {
//        Queue queue = QueueBuilder.durable("auto-task.company-site-configurations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_SITE_CONFIGURATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-teams.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_TEAMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.company-to-dos.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COMPANY_TO_DOS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-exclusion-billing-codes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_EXCLUSION_BILLING_CODES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contact-group-contacts.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_GROUP_CONTRACTS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contact-groups.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_GROUPS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contact-billing-product-associations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_BILLING_PRODUCT_ASSOCIATIONS_SYNC_QUEUE_KEY).noargs());

        Queue queue = QueueBuilder.durable("auto-task.contract-service.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACT_SERVICES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.contract-service-bundles.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.CONTRACT_SERVICE_BUNDLES_SYNC_QUEUE_KEY).noargs());

        queue = QueueBuilder.durable("auto-task.service-call-tickets.sync").withArguments(args).build();
        this.amqpAdmin.declareQueue(queue);
        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
                .with(RabbitKeys.SERVICE_CALL_TICKETS_SYNC_QUEUE_KEY).noargs());


//        queue = QueueBuilder.durable("auto-task.contract-ticket-purchases.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CONTRACT_TICKET_PURCHASES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.countries.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.COUNTRIES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.currencies.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.CURRENCIES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.internal-location-with-business-hours.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INTERNAL_LOCATION_WITH_BUSINESS_HOURS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.inventory-items.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVENTORY_ITEMS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.product-notes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PRODUCT_NOTES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.product-tiers.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PRODUCT_TIERS_SYNC_QUEUE_KEY).noargs());

    }

//    @Bean
//    public void initializationQueue7() {

//        Queue queue = QueueBuilder.durable("auto-task.project-notes.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PROJECT_NOTES_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.inventory-item-serial-numbers.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVENTORY_ITEM_SERIAL_NUMBERS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.inventory-locations.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVENTORY_LOCATIONS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.inventory-transfers.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVENTORY_TRANSFERS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.contract-milestones.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.INVENTORY_TRANSFERS_SYNC_QUEUE_KEY).noargs());


//        queue = QueueBuilder.durable("auto-task.product-vendors.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PRODUCT_VENDORS_SYNC_QUEUE_KEY).noargs());

//        queue = QueueBuilder.durable("auto-task.project-charges.sync").withArguments(args).build();
//        this.amqpAdmin.declareQueue(queue);
//        this.amqpAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange)
//                .with(RabbitKeys.PROJECT_CHARGES_SYNC_QUEUE_KEY).noargs());


//    }


    @Bean
    public Jackson2JsonMessageConverter rabbitMessageConverter(ObjectMapper objectMapper) {
        return new Jackson2JsonMessageConverter(objectMapper);
    }


}
